#define _CRT_SECURE_NO_WARNINGS 1

#include "SList.h"

void test1()
{
	SLTNode* n1 = (SLTNode*)malloc(sizeof(SLTNode));
	assert(n1);

	SLTNode* n2 = (SLTNode*)malloc(sizeof(SLTNode));
	assert(n2);

	SLTNode* n3 = (SLTNode*)malloc(sizeof(SLTNode));
	assert(n3);

	SLTNode* n4 = (SLTNode*)malloc(sizeof(SLTNode));
	assert(n4);

	n1->data = 1;
	n2->data = 2;
	n3->data = 3;
	n4->data = 4;

	n1->next = n2;
	n2->next = n3;
	n3->next = n4;
	n4->next = NULL;
	SListPrint(n1);

	SListPushBack(&n1, 5);
	SListPushBack(&n1, 6);
	SListPushBack(&n1, 7);

	SListPrint(n1);
	SListPushFront(&n1, 0);

	SListPrint(n1);
}

void test2()
{
	SLTNode* plist = NULL;

	SListPushBack(&plist, 1);
	SListPushBack(&plist, 2);
	SListPushBack(&plist, 3);
	SListPushBack(&plist, 4);
	SListPushFront(&plist, 0);

	SListPrint(plist);



	SLTNode* ret = SListFind(plist, 2);
	if (ret)
	{
		SListInsert(&plist, ret, 22);
		SListPrint(plist);
		SListInsert(&plist, ret, 222);
		SListPrint(plist);
		SListErase(&plist, ret);
	}
	SListPrint(plist);

}


int main()
{
	test2();
	return 0;
}